const data = [
  {
    building_id: "43fcf6c3-3a3d-4404-992e-5b202b8bd71c",
    building_level: "-1",
    offInternetCount: 0,
    offInternetCount: 0,
    onInternetCount: 0,
    powerActCount: 0,
    powerDownCount: 0,
    powerFaultCount: 0,
    powerOnCount: 0,
    powerStandbyCount: 0,
    total_count: 0,
  },
  {
    building_id: "44ee1029-f4d2-476e-adc2-6241138cfb5d",
    building_level: "-1",
    offInternetCount: 0,
    offInternetCount: 0,
    onInternetCount: 0,
    powerActCount: 0,
    powerDownCount: 0,
    powerFaultCount: 0,
    powerOnCount: 0,
    powerStandbyCount: 0,
    total_count: 0,
  },
  {
    building_id: "43fcf6c3-3a3d-4404-992e-5b202b8bd71c",
    building_level: "-2",
    offInternetCount: 0,
    offInternetCount: 0,
    onInternetCount: 0,
    powerActCount: 0,
    powerDownCount: 0,
    powerFaultCount: 0,
    powerOnCount: 0,
    powerStandbyCount: 0,
    total_count: 0,
  },
]

const formatConvert = (object) => {
  const result = [],count = []
  data.map((item) => {
    let building_level = item.building_level
    if (!count.includes(building_level)) count.push(building_level)
  })
  count.map((item) => result.push({ floor: item }));
  data.map((item) => {
    let building_level = item.building_level;
    result.forEach((i) => {
      if (i.floor === building_level) {
        i[item.building_id] = { ...item }
      }
    })
  })
  return result
}

const result = formatConvert(data)
console.log(result)
